
function backa()
{
	parent.location.href="index.jsp";
	self.location="modifyBasicInfo.jsp";
}

function click1()
{
	document.getElementById("modify").src="modifyBasicInfo.jsp";
	document.getElementById("button1").className="buttoncss";
	document.getElementById("button2").className="buttoncss2";
	document.getElementById("button3").className="buttoncss2";
	document.getElementById("button4").className="buttoncss2";
}
function click2()
{
	document.getElementById("modify").src="modifyPwInfo.jsp";
	document.getElementById("button1").className="buttoncss2";
	document.getElementById("button2").className="buttoncss";
	document.getElementById("button3").className="buttoncss2";
	document.getElementById("button4").className="buttoncss2";
}
function click3()
{
	document.getElementById("modify").src="modifyPwcInfo.jsp";
	document.getElementById("button1").className="buttoncss2";
	document.getElementById("button2").className="buttoncss2";
	document.getElementById("button3").className="buttoncss";
	document.getElementById("button4").className="buttoncss2";
}
function click4()
{
	document.getElementById("modify").src="modifyEmailInfo.jsp";
	document.getElementById("button1").className="buttoncss2";
	document.getElementById("button2").className="buttoncss2";
	document.getElementById("button3").className="buttoncss2";
	document.getElementById("button4").className="buttoncss";
}
function checkform1()
{
	 if(document.getElementById("real_name").value== "")
	 {
	 	alert('真实姓名不能为空！');
	  return false;
	 }
	 
	 var email = document.getElementById("email");
	 var myreg = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
	 if(email !=null && email.value !="")
	 {
	   if(!myreg.test(email.value))
		 {
	     alert('请输入有效的E_mail！');
	     return false;
		 }
		}
		
		var cellphone = document.getElementById("cellphone");
		var myreg1=/^(13\d|15[89])\d{5}(\d{3}|\*{3})$/;
		if(cellphone !=null && cellphone.value !="")
		{
			if(!myreg1.test(cellphone.value))
			{
			   alert('请输入有效的手机号码！');
			   return false;
			}
		}
		
		var phone = document.getElementById("phone");
		var myreg2 =/^\d{7,8}$/;
		if(phone !=null && phone.value !="")
		{
			if(!myreg2.test(phone.value))
			{
			   alert('请输入有效的电话号码！');
			   return false;
			}
		}
		document.addForm.submit();
}

function checkemailform()
{
	
	 var email = document.getElementById("email");
	 var myreg = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
	 if(email !=null && email.value !="")
	 {
	   if(!myreg.test(email.value))
		 {
	     alert('请输入有效的E_mail！');
	     return false;
		 }
		}
		
		var cellphone = document.getElementById("cellphone");
		var myreg1=/^(13\d|15[89])\d{5}(\d{3}|\*{3})$/;
		if(cellphone !=null && cellphone.value !="")
		{
			if(!myreg1.test(cellphone.value))
			{
			   alert('请输入有效的手机号码！');
			   return false;
			}
		}
		
		var phone = document.getElementById("phone");
		var myreg2 =/^\d{7,8}$/;
		if(phone !=null && phone.value !="")
		{
			if(!myreg2.test(phone.value))
			{
			   alert('请输入有效的电话号码！');
			   return false;
			}
		}
		document.addForm.submit();
}
function checkPW(){
	  	var old_passwd=  document.getElementById("old_passwd").value;
		var user_id= document.getElementById("user_id").value;
		if(old_passwd == null || old_passwd == ""){
		  	alert("原密码不能为空!");
		  	document.pwdForm.old_passwd.focus();
		  	return false;
		  }
		Ti_userInfo.checkOldPW(user_id,old_passwd,function(data){ 
		if(data == 0){
				alert("你输入的原密码不正确!");
				document.getElementById("old_passwd").value = "";
				document.getElementById("old_passwd").focus();
				return false;
			}
		var sure_passwd = document.getElementById("sure_passwd").value;
		var new_passwd = document.getElementById("new_passwd").value;
		if(null == sure_passwd || sure_passwd == ""){
		  	alert("确认密码不能为空!");
		  	document.pwdForm.sure_passwd.focus();
		  	return false;
		  }else if(sure_passwd.length<6){
		  	alert("确认密码设定不能小于6位!");
		  	document.pwdForm.sure_passwd.focus();
		  	return false;
		  }else if(new_passwd != sure_passwd){
		  	alert("两次输入的密码不一致!");
		  	document.pwdForm.sure_passwd.focus();
		  	return false;
		  }
	  	document.pwdForm.submit();
		});
}


function check_passwd_ques(state){
	var passwd_ques = document.getElementById("passwd_ques").value;
	if(state)
	{
		
	}
	else
	{
		if(passwd_ques==null || passwd_ques=="")
		{
			alert('你的密码提示问题为空,请设置密码提示问题和答案！');
			document.getElementById("passwd_ques").value = "";
			document.passwd_quesForm.passwd_ques.focus();
		}
	}
}

function checkAnswer1(){
	Ti_userInfo.checkpasswdAnswer(document.getElementById("user_id").value,document.getElementById("passwd_answer").value,function(data){
			
			var passwd_answer = document.getElementById("passwd_answer").value;
		  if(null == passwd_answer || passwd_answer == ""){
		  	alert("密码提示问题答案不能为空!");
		  	document.passwd_quesForm.passwd_answer.focus();
		  	return false;
		  }
			
			if(data == 0){
				alert('你的原密码提示答案不正确！请重新回答');
				document.getElementById("passwd_answer").value = "";
				document.getElementById("passwd_answer").focus();
				return false;
			}
			window.location.href='modifyPwcInfo2.jsp';
		});
}

function checkAnswer(){
	
		var passwd_ques = document.getElementById("passwd_ques").value;
		if(null == passwd_ques || passwd_ques == ""){
	  	alert("密码提示问题不能为空!");
	  	document.passwd_quesForm.passwd_ques.focus();
	  	return false;
	  }
		
	  var passwd_answer = document.getElementById("passwd_answer").value;
	  var passwd_answer1 = document.getElementById("passwd_answer1").value;
	  if(null == passwd_answer || passwd_answer == ""){
	  	alert("密码提示问题答案不能为空!");
	  	document.passwd_quesForm.passwd_answer.focus();
	  	return false;
	  }
	  if(null == passwd_answer1 || passwd_answer1 == ""){
	  	alert("确认密码提示问题答案不能为空!");
	  	document.passwd_quesForm.passwd_answer1.focus();
	  	return false;
	  }
	  if(passwd_answer != passwd_answer1){
	  	alert("两次输入的密码提示问题答案不一致!");
	  	document.passwd_quesForm.passwd_answer1.focus();
	  	return false;
	  }
	  document.passwd_quesForm.submit();
	  //window.location.href='modifyPwcInfo.jsp';
}
